<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function getsuiji(m, n) {
      return Math.floor(Math.random() * (m - n + 1) + n)
    }
    let result = getsuiji(10, 1)
    for (; ;) {
      let shu = +prompt('请输入一个数字')
      if (shu > result) {
        alert('猜大了哦,请继续')
      }
      if (shu < result) {
        alert('猜小了,请继续')
      }
      if (shu === result) {
        alert('猜对啦,very good')
        break
      }
    }
  </script>
</body>

</html>